﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Janus.Cores.Tools
{
    public class EBSHelper
    {
        public static Guid GUID { get { return Guid.NewGuid(); } }

        /// <summary>
        /// 检查是否有效Guid
        /// </summary>
        /// <param name="guid"></param>
        /// <returns></returns>
        public static bool CheckValidGuid(string guid)
        {
            if (!string.IsNullOrEmpty(guid))
            {
                return CheckValidGuid(new Guid(guid));
            }
            return false;
        }

        /// <summary>
        /// 检查是否有效Guid
        /// </summary>
        /// <param name="guid"></param>
        /// <returns></returns>
        public static bool CheckValidGuid(Guid? guid)
        {
            if (guid != null && guid.ToString() != "00000000-0000-0000-0000-000000000000")
            {
                return true;
            }
            return false;
        }

        /// <summary>
        /// 长日期格式
        /// </summary>
        public static readonly string LOGDATE = "yyyy-MM-dd HH:mm";

        /// <summary>
        /// 短日期格式
        /// </summary>
        public static readonly string SHORTDATE = "yyyy-MM-dd";

        /// <summary>
        /// 6位日期格式，用于创建数据库的单号
        /// </summary>
        public static readonly string SIXNUMDATE = "yyMMddHHmms";

        /// <summary>
        /// 时间格式
        /// </summary>
        public static readonly string TIME = "HH:mm";

        /// <summary>
        /// 默认开始时间
        /// </summary>
        public static DateTime StarDate { get { return DateTime.Parse(DateTime.Now.AddMonths(-3).ToShortDateString()); } }

        /// <summary>
        /// 默认结束时间
        /// </summary>
        public static DateTime EndDate { get { return DateTime.Parse(DateTime.Now.ToShortDateString()); } }
    }
}
